﻿using System.Drawing;
using System.Collections.ObjectModel;
using System;
using System.Linq;
using System.Collections.Generic;

[Serializable]
public class TaxThemeInformation
{
    public string ThemeName { set; get; }

    [System.Xml.Serialization.XmlIgnore]
    public Image Logo { set; get; }
    public string BackgroundColor { set; get; }

    [System.Xml.Serialization.XmlIgnore]
    public Image BackgroundImage { set; get; }
    public string DefaultTextColor { set; get; }

    public string LeftHeaderBackgroundColor { set; get; }
    public string RightHeaderBackgroundColor { set; get; }
    public string HeaderTextColor { set; get; }

    public string PrimaryColor { set; get; }
    public string PrimaryLinkColor { set; get; }

    public string MenuTextColor { set; get; }
    public string BorderColor { set; get; }
    public string ButtonColor { set; get; }
    public string ButtonSecondaryColor { set; get; }
    public string ButtonTextColor { set; get; }

    public string ExportBackgroundColor { set; get; }
    public string ExportTextColor { set; get; }

    public string ReportTotalBackgroundColor { set; get; }
    public string ReportTotalTextColor { set; get; }

    public string GridLineBorderColor { set; get; }
    public string GridHeaderTextColor { set; get; }
    public string GridAlterRowColor { set; get; }

    public string LoginAddrBackgroundColor { set; get; }
    public string LoginAddrTextColor { set; get; }

    [System.Xml.Serialization.XmlIgnore]
    public bool IsUpdateMode { set; get; }

    public DateTime CreatedDate { set; get; }
    public string CreatedUser { set; get; }
    public string CreatedClientID { set; get; }
}
public class TaxThemeInfoCollection : Collection<TaxThemeInformation>
{
    /// <summary>
    /// If not exists then insert else update
    /// </summary>
    /// <param name="theme"></param>
    public void AddOrUpdate(TaxThemeInformation theme)
    {
        foreach (TaxThemeInformation t in base.Items)
        {
            if (t.ThemeName.Equals(theme.ThemeName, StringComparison.OrdinalIgnoreCase))
            {
                base.Items.Remove(t);
                break;
            }
        }
        base.Items.Add(theme);
    }
    public void Sort()
    {
        var ordered = this.Items.OrderBy(t => t.ThemeName).ToList();
        this.Items.Clear();

        foreach (var t in ordered)
        {
            this.Items.Add(t);
        }
       
    }
    
}